package com.hjt.zhibo.tools;

import jodd.http.HttpRequest;
import jodd.http.HttpResponse;

public class HttpContent {

	public static String getUrlContent(String url){
		HttpRequest httpRequest = HttpRequest.get(url); //1. 构建一个get请求
		httpRequest.header("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36");
		httpRequest.header("content-type", "text/html;charset=UTF-8");
		HttpResponse response = httpRequest.send(); //2.发送请求并接受响应信息
		response.header("content-type", "text/html;charset=UTF-8");
		response.charset("UTF-8");
		return response.bodyText();
	}
	
}
